package lipengfei.botaiframework.mybatisplus.extend.method;

import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;
import org.apache.ibatis.scripting.defaults.RawSqlSource;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.metadata.TableInfo;

/**
 * <p>
 * </p>
 *
 * @author lipf
 */
public class FindOneMethod extends AbstractMethod {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
    public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
    	SqlSource sqlSource = new RawSqlSource(configuration,"SELECT * from  "+ tableInfo.getTableName() +" WHERE ID =#{id}", Object.class);
		 return this.addSelectMappedStatementForOther(mapperClass, "findOne", sqlSource, null);

    }
}